package org.csu.onlineedubackend.dto;

import lombok.Data;
import org.csu.onlineedubackend.entity.CommentReply;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

@Data
public class CommentReplyTreeDTO {
    private Integer id;
    private Integer userId;
    private String userName; // 新增
    private String content;
    private LocalDateTime createdAt;
    private List<CommentReplyTreeDTO> children = new ArrayList<>();

    public CommentReplyTreeDTO(CommentReply reply, String userName) {
        this.id = reply.getId();
        this.userId = reply.getUserId();
        this.userName = userName;
        this.content = reply.getContent();
        this.createdAt = reply.getCreatedAt();
    }
}